package com.llw.translate;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;

import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
    public class WelcomeActivity extends AppCompatActivity {

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            //setContentView(R.layout.activity_main);
            AlphaAnimation aa=new AlphaAnimation(0.3f,1.0f);//设置透明度变化区值。
            aa.setDuration(2000);//设置动画持续时间
            View view=View.inflate(this,R.layout.activity_welcome,null);
            View decorView = getWindow().getDecorView();
            decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);

            //隐藏action bar,报错，待解决
//            ActionBar acbar = getSupportActionBar();
//            acbar.hide();

            setContentView(view);
            view.startAnimation(aa);//调用startAnimation开启动画。
            aa.setAnimationListener(new Animation.AnimationListener(){

                @Override
                public void onAnimationStart(Animation animation) {

                }

                @Override
                public void onAnimationEnd(Animation arg0) {
                    redirectTo();
                }

                @Override
                public void onAnimationRepeat(Animation animation) {

                }

            });
        }
        private void redirectTo(){
            Intent intent =new Intent(this,ShouyeActivity.class);
            startActivity(intent);
            overridePendingTransition(R.anim.slide_in_left,R.anim.slide_in_left);
            finish();
        }
    }
